package com.xdclass.thread.hang;

/**
 * @Author: Timo
 * @Date: 2019/4/26 10:45
 * @Description: 挂起操作的DEMO
 */
public class SuspendDemo extends Thread{

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName()+"执行run方法，准备调用Suspend()方法");
        // 挂起线程
        Thread.currentThread().suspend();
        System.out.println(Thread.currentThread().getName()+"执行run方法，调用Suspend()方法结束");

    }

    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(new SuspendDemo());
        thread.start();
        Thread.sleep(3000L);
        // 唤醒操作
        thread.resume();
    }
}
